<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>编辑招聘</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<link rel="stylesheet" type="text/css" href="__ROOT__/public/webapp/css/s_base.css" />
		<link rel="stylesheet" type="text/css" href="__ROOT__/public/webapp/css/s_style.css" />
		<link rel="stylesheet" type="text/css" href="__ROOT__/public/webapp/css/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="__ROOT__/public/webapp/css/swiper.min.css" />
		<link rel="stylesheet" type="text/css" href="__ROOT__/public/webapp/css/s_valide.css" />
	</head>
    <style>
    .company_cell .cell_main{
        padding-top: 10px;
    }
        .right_top{
            margin-top: 0;
        }
    .alertMsg{
	opacity: 0;
	position: fixed;
	z-index: -1;
	width: 100%;
	bottom: 10%;left: 0;
	text-align: center;
	transition: opacity 0.5s;
}
.alertMsg.on{
	opacity: 1;
	z-index: 999;
}
.alertMsg span{
	padding: 0.15rem 0.25rem;
	border-radius: 0.5em;
	background-color: rgba(0,0,0,0.4);
	color: #fff;
	font-size: 0.18rem;
}
.icon-icon{
	line-height: 44px;
	font-size: 0.2rem;
	margin-left: 16px;
}
    </style>
	<body>
		<!--内容-->
		<div class="main_content">
			<!--发布模块-->
			<form action="" method="post" class="release_recruit" style="display: block;">
				<div class="form_content">
					<!--区域-->
					<div class="nogap_cell clearfix">
						<p>
							<i class="iconfont icon-diqu"></i>
							<span>区域</span>
						</p>
						<p>
							<select name="chengshi" datatype="*" nullmsg="请选择所在城市！" onchange="$(this).next('select').selectCity(this);" value="{$vo['chengshi']}">
								<option value="">城市</option>
								<option value="西安">西安</option>
								<option value="成都">成都</option>
								<option value="武汉">武汉</option>
								<option value="郑州">郑州</option>
							</select>
								
							<select name="quyu" datatype="*" nullmsg="请选择所在区域！" value="{$vo['quyu']}">
								<option value="">选择城市</option>
							</select>
							
						</p>
					</div>
					<!--单位名称-->
					<div class="nogap_cell clearfix">
						<p>
							<i class="iconfont icon-gongsi"></i>
							<span>单位名称</span>
						</p>
						<p>
							<input type="text" name="compname" id="" value="{$vo['compname']}" placeholder="请输入名称" datatype="*" nullmsg="请输入名称！"/>
						</p>
					</div>
					<!--岗位名称-->
					<div class="jobs_container">
						<input type="hidden" class="m_id" name="mingcheng" value="{$vo['mingcheng']}">
       					<input type="hidden" class="r_id" name="renshu" value="{$vo['renshu']}">
       					<php>$mingcheng1=explode('|',$vo['mingcheng'])</php>
       					<php>$renshu1=explode('|',$vo['renshu'])</php>
                          <volist name="mingcheng1" id="s" key="j">
                           <php>$si=$j-1</php>
                            <div class="jobs_cell">
							<!--岗位名称-->
							<div class="nogap_cell jobs_wrap clearfix">
								<p>
									<i class="iconfont icon-sidebar_gangweiguanli"></i>
									<span class="jobs_name">岗位1</span>
								</p>
								<p>
									<input type="text" name="" id="" class="jobs" value="{$s}" placeholder="例：销售" datatype="*" nullmsg="请输入岗位名称！" />
									<i class="iconfont icon-jiahao" id="add_work"></i>
								</p>

							</div>
							<!--招聘人数-->
							<div class="nogap_cell clearfix">
								<p>
									<i class="iconfont icon-renshu"></i>
									<span>招聘人数</span>
								</p>
								<p>
									<select name="" class="number" datatype="*" value="{$renshu1.$si}" nullmsg="请选择招聘人数！">
										<option value="">请选择</option>
										<option value="5人以下">5人以下</option>
										<option value="5~10人">5~10人</option>
										<option value="10人以上">10人以上</option>
									</select>
								</p>
							</div>
						</div>
                        </volist>
					</div>
					<!--详情描述-->
					<div class="nogap_cell clearfix">
						<div class="theme_text">
							<i class="iconfont icon-xiangqing"></i>
							<span>详情描述</span>
						</div>
						<div class="">
							<textarea name="des" rows="" cols="" placeholder="限200字" datatype="*1-200" maxlength="200" nullmsg="请填写详细描述！">{$vo['des']}</textarea>
						</div>
					</div>
				</div>
				<!--个人信息-->
				<div class="personinfo_content">
					<div class="nogap_cell clearfix">
						<p>
							<i class="iconfont icon-xingming"></i>
							<span>发布人姓名</span>
						</p>
						<p>
							<input type="text" name="name" id="" value="{$vo['name']}" placeholder="请输入姓名" datatype="*" nullmsg="请输入姓名！" />
						</p>
					</div>
					<div class="nogap_cell clearfix">
						<div class="theme_text">
							<i class="iconfont icon-zhaopian"></i>
							<span>添加微信二维码（选填）</span>
						</div>
						<div class="clearfix">
							<div class="imgmain_container clearfix house_wrap">
                                <php>$erweiimg1=explode('|',$vo['erwei'])</php>
                                   <volist name="erweiimg1" id="s">
                                    <div style="position:relative;" class="new_img eds"><i class="iconfont icon-guanbi" onclick="imgRem(this);"></i><img src="{$s}" data-url="{$s}">
                                    </div>
                                    </volist>
								<div class="upimg_box left">
									<i class="iconfont icon-jiahao1"></i>
									<input type="file" name="" id="house_img" value="" multiple="multiple" />
									<input type="hidden" class="i_id" name="erwei" value="{$vo['erwei']}">
								</div>
								<if condition="$vo['erweiimg1'] neq NULL">
								<p class="img_note">(建议添加，方便对方联系)</p>
                                </if>
							</div>
						</div>
					</div>
					<div class="nogap_cell clearfix">
						<p>
							<i class="iconfont icon-kehudianhua"></i>
							<span>手机号</span>
						</p>
						<p>
							<input type="number" class="phone_code" name="phone" id="phone" value="{$vo['phone']}" placeholder="请输入手机号" datatype="*" nullmsg="请输入手机号！" />
						</p>
					</div>
					<div class="nogap_cell clearfix">
						<p>
							<i class="iconfont icon-anquan2"></i>
							<span>验证码</span>
						</p>
						<p>
							<input type="number" name="vertify_code" id="vertify_code" value="" placeholder="请输入验证码" datatype="*" nullmsg="请输入验证码！" class="code_input" />
							<b class="theme_text send_code">发送验证码</b>
						</p>
					</div>
					<input type="submit" class="submit" value="立即发布" />
				</div>

			</form>
		</div>
        <div class="alertMsg">
	    	<span></span>
	    </div>
	</body>
	<script src="__ROOT__/public/webapp/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript" src="__ROOT__/public/webapp/js/common.js" ></script>
	<script type="text/javascript" src="__ROOT__/public/webapp/js/template.js" ></script>
	<script src="__ROOT__/public/webapp/js/Validform_v5.3.2_min.js" type="text/javascript" charset="utf-8"></script>
	<script src="__ROOT__/public/webapp/js/swiper.jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		// 轮播图
		var swiper = new Swiper('.swiper-container', {
			pagination: '.swiper-pagination',
			paginationClickable: true,
			autoplay: 2000,
			loop: true
		});
                //验证码
        fsTime.init({
            class:".send_code",
            input:".phone_code",
            code:".code_input",
            num:60
        });
		//单位招聘tab切换
		$('.recruit_nav p').bind('click', function() {
			console.log($(this).index());
			$('.recruit_nav p').removeClass('cur_first_nav');
			$(this).addClass('cur_first_nav');
			if($(this).index() == 0) {
				$('.release_recruit').show();
				$('.view_content').hide();
				$('.recruit_nav').css('border', 'none');
			} else if($(this).index() == 1) {
				$('.release_recruit').hide();
				$('.view_content').show();
				$('.recruit_nav').css('border-bottom', '1px solid #ddd');
			}
		})
		window.onscroll = function() {
			var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
			if(scrollTop > 180) {
				$('.recruit_nav').addClass('rent_nav_fixed');
				$('.main_content').css('margin-top', '50px');
			} else {
				$('.recruit_nav').removeClass('rent_nav_fixed');
				$('.main_content').css('margin-top', '0px');

			}
		}
		
		var index = 1;
		$('#add_work').on('click', function() {
			index++;
			var jobs = $('<div class="jobs_cell">' +
				'<div class="nogap_cell jobs_wrap clearfix">' +
				'<p>' +
				'<i class="iconfont icon-sidebar_gangweiguanli"></i>' +
				'<span class="jobs_name">岗位' + index + '</span>' +
				'</p>' +
				'<p>' +
				'<input type="text" name="" class="jobs" id="" value="" placeholder="例：销售" datatype="*" nullmsg="请输入岗位名称！" />' +
				'<i class="iconfont icon-shanchu" id="shanchu_work" onclick="removeli(this);"></i>'+
				'</p>' +
				'</div>' +
				'<div class="nogap_cell clearfix">' +
				'<p>' +
				'<i class="iconfont icon-renshu"></i>' +
				'<span>招聘人数</span>' +
				'</p>' +
				'<p>' +
				'<select name="" class="number" datatype="*" nullmsg="请选择招聘人数！">' +
				'<option value="">请选择</option>' +
				'<option value="5人以下">5人以下</option>' +
				'<option value="5~10人">5~10人</option>' +
				'<option value="10人以上">10人以上</option>' +
				'</select>' +
				'</p>' +
				'</div>' +
				'</div>');
			$('.jobs_container').append(jobs);
			$('.jobs_name').each(function(i){
			var j = i+1;
			$(this).text('岗位'+j);
			})

		});
		var removeli=function(self){
			$(self).parent().parent().parent().remove();
			$('.jobs_name').each(function(i){
			var j = i+1;
			$(this).text('岗位'+j);
			})
		}
		
        
    function selectCallback(){
		$.ajax({
        type: "post",
        url: "http://www.caizhanzhushou.com/index.php?g=Wechat&m=Webzhuan&a=zhaojiangfan",
        "contentType": "application/x-www-form-urlencoded; charset=utf-8",
        data:{},
        dataType: "json",
        success: function (data ,textStatus, jqXHR)
        {
            if(data.length>0){
            var html=$("#chuzulist").html(),datas={
                data:data
            };
            var thtml=template(html,datas);
            
              $("#zulist").html(thtml);
                }else{
               $("#zulist").html("<div class='nodata'>暂无匹配数据</div>");     
                }  
                
            
        },
        error:function (XMLHttpRequest, textStatus, errorThrown) {      
        }
     });
	};
        			//			表单验证
			$.Tipmsg.r=null;
      
				
			var showmsg=function(msg){
				toggleAlert(msg);
			};
			
			$(".release_recruit").Validform({
				datatype:{
					"phone":function(gets,obj,curform,regxp){
						/*参数gets是获取到的表单元素值，
						  obj为当前表单元素，
						  curform为当前验证的表单，
						  regxp为内置的一些正则表达式的引用。*/
		
						var reg1=/^1(3|4|5|7|8)[0-9]\d{8}$/,
							reg2=/^1(3|4|5|7|8)[0-9]\d{8}$/,
							mobile=curform.find(".mobile");
						
						if(reg1.test(mobile.val())){return true;}
						if(reg2.test(gets)){return true;}
						
						return false;
					},
				},
				ajaxPost:false,
				tiptype:function(msg){
					showmsg(msg);
				},
				tipSweep:true,
			});
        var gangwei_str = [];
		var number_str = [];
		$('.release_recruit').on("submit",function(e) {
			//遍历岗位名称
			$(".jobs").each(function(index,element) {
				gangwei_str.push($(element).val());
			});
			gangwei_str = gangwei_str.join('|');
			console.log(gangwei_str);

			//遍历人数
			$(".number").each(function(index,element) {
				number_str.push($(element).val());
			});
			number_str = number_str.join('|');
            $(".m_id").val(gangwei_str);
            $(".r_id").val(number_str);
			console.log(number_str);
			
			if(gangwei_str || number_str){
				return false;
			}
		});
        selectCallback();
        $("select").selectSelected();
        $("input[type=file]").imgupload();
	</script>

</html>